/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.invoice.busines;

import com.invoice.busines.dto.ComprobanteDTO;
import com.invoice.exceptions.InvoiceException;
import com.invoice.model.dao.ComprobanteDAO;
import com.invoice.model.dao.ComprobanteDAOHibernate;
import com.invoice.enums.TipoComprobante;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 *
 * @author Lidia
 */
public class ComprobanteBOImpl implements ComprobanteBO, Serializable {

    ComprobanteDAO comprobanteDAO = new ComprobanteDAOHibernate();
    
    @Override
    public ComprobanteDTO addComprobante(ComprobanteDTO comprobanteDTO) throws InvoiceException {
        Integer id = (Integer)comprobanteDAO.add(comprobanteDTO);
        comprobanteDTO.setIdComprobante(id);
        return comprobanteDTO;
    }
        
    @Override
    public void updateComprobante(ComprobanteDTO comprobanteDTO) throws InvoiceException {
        comprobanteDAO.update(comprobanteDTO);
    }
    
    @Override
    public ComprobanteDTO findComprobante(String codigoComprobante) throws InvoiceException {
        throw new UnsupportedOperationException("Not supported yet.");
    }
    
    @Override
    public List<ComprobanteDTO> findAll() throws InvoiceException {
        return comprobanteDAO.findAll();
    }

    @Override
    public List<TipoComprobante> findTiposComprobante() throws Exception {
        return comprobanteDAO.findTiposComprobante();
    }

    @Override
    public void delete(ComprobanteDTO comprobanteDTO) throws InvoiceException {
        comprobanteDAO.delete(comprobanteDTO);
    }

    @Override
    public List<ComprobanteDTO> findGroupByFecha() throws InvoiceException {
        return comprobanteDAO.findGroupByFecha();
    }

    @Override
    public BigDecimal findTotalGroupByFecha(Date fecha) throws InvoiceException {
        return comprobanteDAO.findTotalGroupByFecha(fecha);
    }
}